<template>
  <div style="display: flex;justify-content: space-around;width:100%;">
    <router-link :to="{name:type}" class="docterRoom one-area">
      <div class="img-box">
        <img src="../../image/icon_share_clinic@2x_03.png" />
      </div>
      <span>智能诊室</span>
    </router-link>
    <router-link to='liveZone' class="one-area">
      <div class="img-box">
        <img src="../../image/icon_live.png" />
      </div>
      <span>课程专区</span>
    </router-link>

    <a class="one-area" @click='goDocConsultation'>
      <div class="img-box">
        <img src="../../image/tab_list_click.png" />
      </div>
      <span>专家会诊</span>
    </a>
    <router-link to="myClinic" class="docterRoom one-area">
      <div class="img-box">
        <img src="../../image/icon_my_clinic@2x.png" alt="">
      </div>
      <span>病历管理</span>
    </router-link>
  </div>

</template>
<script>
  export default {
    data() {
      return {
        type: '',
        list: [],
        userid: '',
        usertype: '',
      }
    },
    computed: {
      // 登录拦截
      isLogin() {
        this.userid = localStorage.getItem("loginMobile");
        if (!this.userid) {
          return false;
        } else {
          return true;
        }
      },
    },
    methods: {
      //专家会诊
      goDocConsultation() {
        if (this.usertype == "doctor") {
          this.$router.push({
            name: 'docConsultation'
          });
        } else {
          this.$router.push({
            name: 'authentication'
          });
        }
      },
      justUserType() { //判断用户是否通过医生认证
        if (localStorage.getItem("loginMobile")) {
          this.userid = localStorage.getItem("loginMobile");
          this.$api.get(this.$api.baseURLSchool, "select_cid/user/" + this.userid, {}, r => {
            localStorage.setItem("type_sub", JSON.stringify(r.data.info.type_sub));
            localStorage.setItem("type", JSON.stringify(r.data.info.type));
            if (r.data.info.type == 'clinic') {
              this.type = 'ImClinic'
            } else if (r.data.info.type == 'doctor') {
              this.type = 'ImDoctor'
            }
            if (r.data.ret == 1) {
              if (r.data.info.type) {
                this.usertype = r.data.info.type;
              }
            }
          }, err => {
            console.log(err);
          })
        }
      },

    },
    created() {
      this.justUserType();;
    },
    activated() {

    },
  }

</script>

<style lang="scss" scoped>
  @import "../../css/swiper.min.css";
  @import "../../css/scss/home/home.css";

</style>
